<template>
	<view class="order">
		<view class="orderTop">
			<tm-tabs v-model="activeIndex" :list="list" bg-color="white" color="orange" font-color="grey" align='split' @change='changeindex' ></tm-tabs>
		</view>
	
			<AllOrder v-if="chonse == activeIndex " :orderType="activeIndex" v-for="(item,id) in data" :data="item" :key="id" @cancelOrder='test'></AllOrder>
	
			<!-- <tm-empty icon="/static/images/empty.png" :size='600' label='订单暂时为空'></tm-empty> -->
			
		
		
		

	</view>
</template>

<script>
	import AllOrder from '../../compoments/AllOrder.vue'
export default {
	components:{
		AllOrder
	},
	onLoad(ref){
			this.id=ref.id
		this.activeIndex =ref.avtiveid
		this.searchOrder(0)
	},
	data() {
		return {
			title: 'Hello',
			activeIndex: 0,
			active: 1,
			chonse:0,
			id:'',
			list: ['已支付', '待支付', '租赁中', '已完成', '已取消'],// 顶部选项卡切换
			data:''
		};
	},
	methods: {
		changeindex(e){
		this.chonse = e
		this.searchOrder(e)
		},
		async searchOrder(type){
			const Rres = await  this.$wxRequest({
				url:'/wx/search_all_order',
				method:'POST',
				data:{
					AO007:type,
				}
			})
			this.data =Rres.data.data
			console.log(this.data)
		},
		async test(AO010){
		const Rres = await  this.$wxRequest({
			url:'/wx/cancel_order',
			method:'POST',
			data:{
				AO010:AO010,
			}
		})
		if(Rres.data.code==200){
		this.searchOrder(0)
		}else{
			
		}
		
		}
	}
};
</script>


<style lang="scss" scoped>
	.order{
		height: 100%;
		width: 100%;

	}


</style>
